import React, { Component } from 'react';
import StrideChild from './child1'
import StrideChild2 from './child2'
import StrideChild3 from './child3使用contextType'
// 导入共享数据
import { globalData, getGlobalData, globalContext } from './globalData/js/globalData'
// 合并state数据
// 解构gglobalContext
const { Provider } = globalContext
class StrideParent extends Component {
    state = {
        ...globalData,
        ...getGlobalData(this)
    }
    render() {
        return (<>
            <h3>7.3跨级组件通信</h3>
            <Provider value={this.state}>
                父组件读取role:{this.state.role}
                <StrideChild footer={<div>footer区域</div>}>匿名插槽==props.children</StrideChild>
                <StrideChild2/>
                <StrideChild3/>
            </Provider>
        </>);
    }
}

export default StrideParent;